<?php
session_start();
$link = mysql_connect("localhost", "root", "1234");
mysql_select_db("busticket", $link);
mysql_query("SET NAMES UTF8");
for ($i = 0; $i < count($_SESSION['c_seat']); $i++) {
	$detail = $_SESSION['route'].";".$_SESSION['xtime']." - ".$_SESSION['ytime'].";".$_SESSION['date'];
	mysql_query("insert into busseat values (null,'".$_SESSION['c_seat'][$i]."',".$_SESSION['busid'].")",$link);
	mysql_query("insert into logticket values (null,'".$_SESSION['memberid']."',".$_SESSION['busid'].",".$_SESSION['price'].",'".$detail."')",$link);
}
mysql_close($link);
header("Location:buydetailControl.php");
?>